package main

import (
	"fmt"
	"reflect"
)

func main() {
	var age interface{} = 25

	fmt.Printf("原始接口变量类型为%T, 值为%v \n", age, age)

	t := reflect.TypeOf(age)
	v := reflect.ValueOf(age)

	fmt.Printf("从接口变量到反射对象: Type对象的类型为%T \n", t)
	fmt.Printf("从接口变量到反射对象: Value对象的类型为%T \n", v)

	i := v.Interface()
	fmt.Printf("从反射对象到接口变量: 新对象的类型为%T值为%v\n", i, i)

	name := "Go 编程"
	v1 := reflect.ValueOf(name)
	fmt.Println(v1.CanSet())

	v2 := reflect.ValueOf(&name).Elem()
	fmt.Println(v2.CanSet())
	v2.SetString("Python变成时光")
	fmt.Println(name)
}
